package net.web.milkteapos.bean;

import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Table;

/**
 * 价格表
 */
@Table("money")
public class Money {

	@Id
	@Column("money_id")
	private int moneyId;
	@Column("amount")
	private int amount;
	@Column("currency")
	private String currency;
	
	public Money(){
		this.amount = 0;
		this.currency = "RMB";
	}
	public Money(int amount) {
		this.amount = amount;
		this.currency = "RMB";
	}
	public int getAmount() {
		return amount;
	}
	public void setAmount(int amount) {
		this.amount = amount;
	}
	public String getCurrency() {
		return currency;
	}
	public void setCurrency(String currency) {
		this.currency = currency;
	}
	
	public int getMoneyId() {
		return moneyId;
	}
	public void setMoneyId(int moneyId) {
		this.moneyId = moneyId;
	}
	/**
	 * 增加
	 * @param total
	 * @return
	 */
	public void add(Money money){
		amount += money.getAmount();
	}
	
	/**
	 * @param quantity
	 * @return
	 */
	public Money times(int quantity){
		amount = amount * quantity;
		return this;
	}
	
	/**
	 * 减少
	 * @param product
	 * @return
	 */
	public Money minus(Money total){
		amount = amount - total.getAmount();
		return this;
	}
}
